package com.ustudy.entity.ec;

import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.ustudy.core.dao.support.entity.LongIdEntity;

/**
 * 商品分类类别
 * @author Hector.Tong
 * 2017年2月20日 下午9:29:31
 */
@SuppressWarnings("serial")
@Entity(name="GoodsClassifyType")
@Table(name="EC_GOODS_CLASSIFY_TYPE")
public class GoodsClassifyType extends LongIdEntity {
	
	private String code;
	
	private String name;
	
	@Column
	@Lob
	@Basic(fetch=FetchType.LAZY)
	private String memo;

	@OneToMany(cascade={CascadeType.REMOVE},fetch=FetchType.LAZY,mappedBy="classifyType")
	private List<GoodsClassify> classifies;
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public List<GoodsClassify> getClassifies() {
		return classifies;
	}

	public void setClassifies(List<GoodsClassify> classifies) {
		this.classifies = classifies;
	}
	
	public String getLabel(){
		
		return new StringBuffer(name).append("(").append(code).append(")").toString();
	}
}
